package com.itheima.server.service;

import com.itheima.dubbo.api.mongo.UserLocationApi;
import com.itheima.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;

    /**
     * 更新或者插入当前用户的地理位置
     * @param longitude
     * @param latitude
     * @param addrStr
     */
    public void updateLocation(Double longitude, Double latitude, String addrStr) {
        Long userId = UserHolder.getId();
        userLocationApi.updateOrSaveLocation(userId,longitude,latitude,addrStr);
    }
}
